import { Boot, IDomEditor } from '@wangeditor/editor'

import mateSelectModal from "@/components/mate/select-modal/index.vue";

import {
    getCurrentInstance,
    h
} from "vue";

class imageTool {
    title: string;
    tag: string;
    constructor(public readonly callback:Function ) {
        (this.title = "图片"), 
        (this.tag = "button");
    }
    getValue() {
        return "";
    }
    isActive() {
        return false;
    }
    isDisabled() {
        return false;
    }
    exec(editor: IDomEditor) {
        var callback = editor.getMenuConfig('imageTool').callback || ''
        if(callback && typeof callback == 'function'){
            callback()
        }
    }
}

const callback = () => {
    console.log(123)
}

const imageToolConf = {
    key: "imageTool",
    factory() {
        return new imageTool(callback);
    },
};

export const initEditorTool = () => {
    Boot.registerMenu(imageToolConf)
}
